package com.web.ShoppingDemo.serviceImpl;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.web.ShoppingDemo.model.Product;
import com.web.ShoppingDemo.service.ProductService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:applicationContext-*.xml")
public class ProductServiceImplTest {
	@Resource
	private ProductService productService;
	
	@Test
	public void testQueryJoinCategory() {
		System.out.println(productService.queryJoinCategory("", 2, 3).get(1).getCategory().getHot());
	}

	@Test
	public void testGetCount() {
		System.out.println(productService.getCount(""));
	}

	@Test
	public void testDeleteByIds() {
		productService.deleteByIds("1");
	}
	
	@Test
	public void save(){
		//[id=null, name=33, price=33.0,fd64a905-b171-4903-82c5-b62aa5ae0d86.jpg,33,33,null,false,true]
		//Product p = new Product("33",33.0,"b62aa5ae0d86.jpg");
		//productService.save(p);
	}
	@Test
	public void queryByCid(){
		for(Product product:productService.queryByCid(1)){
			System.out.println(product.getName());
		}
	}

}
